/*
 * Copyright (c) Tan Menglong.
 * All rights reserved.
 * 
 * This file is part of the RabbitOS.  The RabbitOS is free software, also known
 * as "open source;" you can redistribute it and/or modify it under the terms
 * of the GNU General Public License (GPL), version 2, as published by the Free
 * Software Foundation (FSF).  To explore alternate licensing terms, contact
 * the Tan Menglong at TanMenglong@gmail.com or +86-15972108715.
 * 
 * The RabbitOS is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GPL for more details.  You should have
 * received a copy of the GPL along with the RabbitOS; see the file COPYING.  If
 * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
 */
/*
 * Header for Interupt Service Routine.
 * Part of this code is modified from Bran's kernel development tutorials.
 * 09-Jun-08
 */

#ifndef _INIT_ISR_H
#define _INIT_ISR_H

#include<asm/io.h>
#include<sys/types.h>

// A few defines to make life a little easier
#define IRQ0 32
#define IRQ1 33
#define IRQ2 34
#define IRQ3 35
#define IRQ4 36
#define IRQ5 37
#define IRQ6 38
#define IRQ7 39
#define IRQ8 40
#define IRQ9 41
#define IRQ10 42
#define IRQ11 43
#define IRQ12 44
#define IRQ13 45
#define IRQ14 46
#define IRQ15 47

typedef struct registers {
	u32int ds;					//Data segment selector
	u32int edi, esi, ebp, esp, ebx, edx, ecx, eax;	// Pushed by pusha.
	u32int int_no, err_code;	// Interrupt number and error code (if applicable)
	u32int eip, cs, eflags, useresp, ss;	// Pushed by the processor automatically.
} registers_t;

// Enables registration of callbacks for interrupts or IRQs.
// For IRQs, to ease confusion, use the #defines above as the
// first parameter.
typedef void (*isr_t) (registers_t);
extern void register_interrupt_handler(u8int n, isr_t handler);

#endif							//_INIT_ISR_H
